home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / 23pick / 23pickup.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-12-05  |  16.0 KB  |  603 lines

  1. VERSION 2.00
  2. Begin Form Pickup 
  3.    BackColor       =   &H00FFFFFF&
  4.    Caption         =   "23 Pickup"
  5.    ClientHeight    =   2310
  6.    ClientLeft      =   1170
  7.    ClientTop       =   1905
  8.    ClientWidth     =   7755
  9.    Height          =   3000
  10.    Icon            =   23PICKUP.FRX:0000
  11.    Left            =   1110
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   2310
  16.    ScaleWidth      =   7755
  17.    Top             =   1275
  18.    Width           =   7875
  19.    Begin Timer Timer1 
  20.       Enabled         =   0   'False
  21.       Interval        =   1000
  22.       Left            =   4080
  23.       Top             =   1680
  24.    End
  25.    Begin CommandButton Command1 
  26.       Caption         =   "-&3"
  27.       FontBold        =   -1  'True
  28.       FontItalic      =   0   'False
  29.       FontName        =   "MS Sans Serif"
  30.       FontSize        =   24
  31.       FontStrikethru  =   0   'False
  32.       FontUnderline   =   0   'False
  33.       Height          =   615
  34.       Index           =   3
  35.       Left            =   5880
  36.       TabIndex        =   7
  37.       Top             =   1560
  38.       Width           =   975
  39.    End
  40.    Begin CommandButton Command1 
  41.       Caption         =   "-&2"
  42.       FontBold        =   -1  'True
  43.       FontItalic      =   0   'False
  44.       FontName        =   "MS Sans Serif"
  45.       FontSize        =   24
  46.       FontStrikethru  =   0   'False
  47.       FontUnderline   =   0   'False
  48.       Height          =   615
  49.       Index           =   2
  50.       Left            =   5880
  51.       TabIndex        =   6
  52.       Top             =   840
  53.       Width           =   975
  54.    End
  55.    Begin CommandButton Command1 
  56.       Caption         =   "-&1"
  57.       FontBold        =   -1  'True
  58.       FontItalic      =   0   'False
  59.       FontName        =   "MS Sans Serif"
  60.       FontSize        =   24
  61.       FontStrikethru  =   0   'False
  62.       FontUnderline   =   0   'False
  63.       Height          =   615
  64.       Index           =   1
  65.       Left            =   5880
  66.       TabIndex        =   0
  67.       Top             =   120
  68.       Width           =   975
  69.    End
  70.    Begin Label Label5 
  71.       BackColor       =   &H00FFFFFF&
  72.       Caption         =   "stick(s)"
  73.       FontBold        =   -1  'True
  74.       FontItalic      =   0   'False
  75.       FontName        =   "Times New Roman"
  76.       FontSize        =   18
  77.       FontStrikethru  =   0   'False
  78.       FontUnderline   =   0   'False
  79.       Height          =   495
  80.       Left            =   2160
  81.       TabIndex        =   5
  82.       Top             =   1560
  83.       Width           =   1095
  84.    End
  85.    Begin Label Label4 
  86.       BackColor       =   &H00FFFFFF&
  87.       FontBold        =   -1  'True
  88.       FontItalic      =   0   'False
  89.       FontName        =   "Times New Roman"
  90.       FontSize        =   18
  91.       FontStrikethru  =   0   'False
  92.       FontUnderline   =   0   'False
  93.       Height          =   495
  94.       Left            =   1680
  95.       TabIndex        =   4
  96.       Top             =   1560
  97.       Width           =   375
  98.    End
  99.    Begin Label Label3 
  100.       BackColor       =   &H00FFFFFF&
  101.       Caption         =   "I take"
  102.       FontBold        =   -1  'True
  103.       FontItalic      =   0   'False
  104.       FontName        =   "Times New Roman"
  105.       FontSize        =   18
  106.       FontStrikethru  =   0   'False
  107.       FontUnderline   =   0   'False
  108.       Height          =   495
  109.       Left            =   720
  110.       TabIndex        =   3
  111.       Top             =   1560
  112.       Width           =   975
  113.    End
  114.    Begin Label Label2 
  115.       Alignment       =   2  'Center
  116.       BackColor       =   &H00FFFFFF&
  117.       Caption         =   "Left"
  118.       FontBold        =   -1  'True
  119.       FontItalic      =   0   'False
  120.       FontName        =   "Arial"
  121.       FontSize        =   48
  122.       FontStrikethru  =   0   'False
  123.       FontUnderline   =   0   'False
  124.       Height          =   1095
  125.       Left            =   2040
  126.       TabIndex        =   2
  127.       Top             =   120
  128.       Width           =   2295
  129.    End
  130.    Begin Label Label1 
  131.       Alignment       =   2  'Center
  132.       BackColor       =   &H00FFFFFF&
  133.       FontBold        =   -1  'True
  134.       FontItalic      =   0   'False
  135.       FontName        =   "Arial"
  136.       FontSize        =   48
  137.       FontStrikethru  =   0   'False
  138.       FontUnderline   =   0   'False
  139.       Height          =   1095
  140.       Left            =   360
  141.       TabIndex        =   1
  142.       Top             =   120
  143.       Width           =   1455
  144.    End
  145.    Begin Menu file 
  146.       Caption         =   "&Game"
  147.       Begin Menu new 
  148.          Caption         =   "&New"
  149.          Shortcut        =   {F2}
  150.       End
  151.       Begin Menu ex 
  152.          Caption         =   "E&xit"
  153.          Shortcut        =   ^X
  154.       End
  155.       Begin Menu thing 
  156.          Caption         =   "-"
  157.       End
  158.       Begin Menu abt 
  159.          Caption         =   "&About 23 Pickup..."
  160.       End
  161.    End
  162.    Begin Menu options 
  163.       Caption         =   "&Options"
  164.       Begin Menu level 
  165.          Caption         =   "&Level of Difficulty"
  166.          Begin Menu easy 
  167.             Caption         =   "&Easy"
  168.          End
  169.          Begin Menu medium 
  170.             Caption         =   "&Medium"
  171.             Checked         =   -1  'True
  172.          End
  173.          Begin Menu hard 
  174.             Caption         =   "&Hard"
  175.          End
  176.       End
  177.       Begin Menu startplay 
  178.          Caption         =   "&Starting Player"
  179.          Begin Menu youstart 
  180.             Caption         =   "&You Start"
  181.             Checked         =   -1  'True
  182.          End
  183.          Begin Menu compstart 
  184.             Caption         =   "&Computer Starts"
  185.          End
  186.       End
  187.       Begin Menu back 
  188.          Caption         =   "&Background Color"
  189.          Begin Menu green 
  190.             Caption         =   "&Green"
  191.          End
  192.          Begin Menu blue 
  193.             Caption         =   "&Blue"
  194.          End
  195.          Begin Menu purple 
  196.             Caption         =   "&Purple"
  197.          End
  198.          Begin Menu red 
  199.             Caption         =   "&Red"
  200.          End
  201.          Begin Menu yellow 
  202.             Caption         =   "&Yellow"
  203.          End
  204.          Begin Menu bluegray 
  205.             Caption         =   "B&lue-Gray"
  206.          End
  207.          Begin Menu gray 
  208.             Caption         =   "Gr&ay"
  209.          End
  210.          Begin Menu white 
  211.             Caption         =   "&White"
  212.             Checked         =   -1  'True
  213.          End
  214.       End
  215.    End
  216.    Begin Menu help 
  217.       Caption         =   "&Help"
  218.    End
  219. Sub abt_Click ()
  220. Load about
  221. about.Show
  222. End Sub
  223. Sub blue_Click ()
  224. green.checked = 0
  225. white.checked = 0
  226. red.checked = 0
  227. yellow.checked = 0
  228. blue.checked = -1
  229. purple.checked = 0
  230. bluegray.checked = 0
  231. gray.checked = 0
  232. h = &HFFFF00
  233. pickup.backColor = h
  234. label1.backColor = h
  235. label2.backColor = h
  236. label3.backColor = h
  237. label4.backColor = h
  238. label5.backColor = h
  239. End Sub
  240. Sub bluegray_Click ()
  241. green.checked = 0
  242. white.checked = 0
  243. red.checked = 0
  244. yellow.checked = 0
  245. blue.checked = 0
  246. purple.checked = 0
  247. bluegray.checked = -1
  248. gray.checked = 0
  249. h = &H808000
  250. pickup.backColor = h
  251. label1.backColor = h
  252. label2.backColor = h
  253. label3.backColor = h
  254. label4.backColor = h
  255. label5.backColor = h
  256. End Sub
  257. Sub Command1_Click (Index As Integer)
  258. label4.caption = ""
  259. x = Val(label1.caption)
  260. If x < Index Then Beep: Exit Sub
  261. label1.caption = Str$(x - Index): x = Val(label1.caption)
  262. If Val(label1.caption) = 0 Then
  263.     MsgBox "You lost.", 16, "Sorry, Dude": Exit Sub
  264. End If
  265. timer1.enabled = -1
  266. End Sub
  267. Sub Command2_Click ()
  268. x = Val(label1.caption)
  269. If x < 2 Then Beep: Exit Sub
  270. label1.caption = Str$(x - 2): x = Val(label1.caption)
  271. If Val(label1.caption) = 1 Then
  272.     label4.caption = Str$(1)
  273.     label1.caption = Str$(0)
  274.     MsgBox "You Won!", 48, "Congratulations"
  275. ElseIf Val(label1.caption) = 0 Then
  276.     MsgBox "You lost.", 16, "Sorry, Dude"
  277. End If
  278. If i = 3 Then
  279.     For e = 1 To 21 Step 4
  280.         If x - e > 0 And x - e < 4 Then
  281.             label4.caption = Str$(x - e)
  282.             label1.caption = Str$(e): x = Val(label1.caption)
  283.         ElseIf x - e = 0 And x <> 1 Then
  284.             y = Int(3 * Rnd + 1)
  285.             label4.caption = Str$(y)
  286.             label1.caption = Str$(x - y): x = Val(label1.caption)
  287.         End If
  288.     Next e
  289. If (Val(label1.caption) > 8 And i < 3) Or (Val(label1.caption) = 5 And i < 3) Or (i = 1 And Val(label1.caption) > 5) Then
  290.     If i < 3 Then
  291.     y = Int(3 * Rnd + 1)
  292.     label4.caption = Str$(y)
  293.     x = Val(label1.caption)
  294.     label1.caption = Str$(x - y)
  295.     End If
  296. ElseIf Val(label1.caption) < 9 And Val(label1.caption) > 5 And i > 1 Then
  297.     For d = 6 To 8
  298.         If d = Val(label1.caption) Then
  299.             y = d - 5
  300.             label4.caption = Str$(y)
  301.             x = Val(label1.caption)
  302.             label1.caption = Str$(x - y)
  303.         End If
  304.     Next d
  305. ElseIf Val(label1.caption) < 5 And Val(label1.caption) > 1 Then
  306.     For a = 2 To 4
  307.         If a = Val(label1.caption) Then
  308.             y = a - 1
  309.             label4.caption = Str$(y)
  310.             x = Val(label1.caption)
  311.             label1.caption = Str$(x - y)
  312.         End If
  313.     Next a
  314. End If
  315. End If
  316. End Sub
  317. Sub Command3_Click ()
  318. x = Val(label1.caption)
  319. If x < 3 Then Beep: Exit Sub
  320. label1.caption = Str$(x - 3): x = Val(label1.caption)
  321. If Val(label1.caption) = 1 Then
  322.     label4.caption = Str$(1)
  323.     label1.caption = Str$(0)
  324.     MsgBox "You Won!", 48, "Congratulations"
  325. ElseIf Val(label1.caption) = 0 Then
  326.     MsgBox "You lost.", 16, "Sorry, Dude"
  327. End If
  328. If i = 3 Then
  329.     For e = 1 To 21 Step 4
  330.         If x - e > 0 And x - e < 4 Then
  331.             label4.caption = Str$(x - e)
  332.             label1.caption = Str$(e): x = Val(label1.caption)
  333.         ElseIf x - e = 0 And x <> 1 Then
  334.             y = Int(3 * Rnd + 1)
  335.             label4.caption = Str$(y)
  336.             label1.caption = Str$(x - y): x = Val(label1.caption)
  337.         End If
  338.     Next e
  339. If (Val(label1.caption) > 8 And i < 3) Or (Val(label1.caption) = 5 And i < 3) Or (i = 1 And Val(label1.caption) > 5) Then
  340.     If i < 3 Then
  341.     y = Int(3 * Rnd + 1)
  342.     label4.caption = Str$(y)
  343.     x = Val(label1.caption)
  344.     label1.caption = Str$(x - y)
  345.     End If
  346. ElseIf Val(label1.caption) < 9 And Val(label1.caption) > 5 And i > 1 Then
  347.     For d = 6 To 8
  348.         If d = Val(label1.caption) Then
  349.             y = d - 5
  350.             label4.caption = Str$(y)
  351.             x = Val(label1.caption)
  352.             label1.caption = Str$(x - y)
  353.         End If
  354.     Next d
  355. ElseIf Val(label1.caption) < 5 And Val(label1.caption) > 1 Then
  356.     For a = 2 To 4
  357.         If a = Val(label1.caption) Then
  358.             y = a - 1
  359.             label4.caption = Str$(y)
  360.             x = Val(label1.caption)
  361.             label1.caption = Str$(x - y)
  362.         End If
  363.     Next a
  364. End If
  365. End If
  366. End Sub
  367. Sub compstart_Click ()
  368. c = 1
  369. youstart.checked = 0
  370. compstart.checked = -1
  371. If i = 3 Then
  372.     label4.caption = Str$(2)
  373.     label1.caption = Str$(21)
  374.     r = Int(3 * Rnd + 1)
  375.     label4.caption = Str$(r)
  376.     label1.caption = Str$(23 - r)
  377. End If
  378. End Sub
  379. Sub easy_Click ()
  380. i = 1
  381. easy.checked = -1
  382. medium.checked = 0
  383. hard.checked = 0
  384. If c = 1 Then
  385.     r = Int(3 * Rnd + 1)
  386.     label4.caption = Str$(r)
  387.     label1.caption = Str$(23 - r)
  388.     label1.caption = Str$(23)
  389.     label4.caption = ""
  390. End If
  391. End Sub
  392. Sub ex_Click ()
  393. Unload pickup
  394. End Sub
  395. Sub Form_Click ()
  396. If about.visible = -1 Then
  397.     Beep
  398.     about.Show
  399. End If
  400. End Sub
  401. Sub Form_Load ()
  402. i = 2
  403. Randomize
  404. label1.caption = Str$(23)
  405. End Sub
  406. Sub gray_Click ()
  407. green.checked = 0
  408. white.checked = 0
  409. red.checked = 0
  410. yellow.checked = 0
  411. blue.checked = 0
  412. purple.checked = 0
  413. bluegray.checked = 0
  414. gray.checked = -1
  415. h = &HC0C0C0
  416. pickup.backColor = h
  417. label1.backColor = h
  418. label2.backColor = h
  419. label3.backColor = h
  420. label4.backColor = h
  421. label5.backColor = h
  422. End Sub
  423. Sub green_Click ()
  424. green.checked = -1
  425. white.checked = 0
  426. red.checked = 0
  427. yellow.checked = 0
  428. blue.checked = 0
  429. purple.checked = 0
  430. bluegray.checked = 0
  431. gray.checked = 0
  432. h = &HFF00&
  433. pickup.backColor = h
  434. label1.backColor = h
  435. label2.backColor = h
  436. label3.backColor = h
  437. label4.backColor = h
  438. label5.backColor = h
  439. End Sub
  440. Sub hard_Click ()
  441. i = 3
  442. easy.checked = 0
  443. medium.checked = 0
  444. hard.checked = -1
  445. If c = 1 Then
  446.     label4.caption = Str$(2)
  447.     label1.caption = Str$(21)
  448.     label1.caption = Str$(23)
  449.     label4.caption = ""
  450. End If
  451. End Sub
  452. Sub help_Click ()
  453. MsgBox "For help on 23 Pickup, please open the file 23PICKUP.TXT using Windows Notepad.", 64, "23 Pickup"
  454. End Sub
  455. Sub medium_Click ()
  456. i = 2
  457. easy.checked = 0
  458. medium.checked = -1
  459. hard.checked = 0
  460. If c = 1 Then
  461.     r = Int(3 * Rnd + 1)
  462.     label4.caption = Str$(r)
  463.     label1.caption = Str$(23 - r)
  464.     label1.caption = Str$(23)
  465.     label4.caption = ""
  466. End If
  467. End Sub
  468. Sub new_Click ()
  469. If c = 1 Then
  470.     If i = 3 Then
  471.         label4.caption = Str$(2)
  472.         label1.caption = Str$(21)
  473.     Else
  474.         r = Int(3 * Rnd + 1)
  475.         label4.caption = Str$(r)
  476.         label1.caption = Str$(23 - r)
  477.     End If
  478.     label1.caption = Str$(23)
  479.     label4.caption = ""
  480. End If
  481. End Sub
  482. Sub purple_Click ()
  483. green.checked = 0
  484. white.checked = 0
  485. red.checked = 0
  486. yellow.checked = 0
  487. blue.checked = 0
  488. purple.checked = -1
  489. bluegray.checked = 0
  490. gray.checked = 0
  491. h = &HFF00FF
  492. pickup.backColor = h
  493. label1.backColor = h
  494. label2.backColor = h
  495. label3.backColor = h
  496. label4.backColor = h
  497. label5.backColor = h
  498. End Sub
  499. Sub red_Click ()
  500. green.checked = 0
  501. white.checked = 0
  502. red.checked = -1
  503. yellow.checked = 0
  504. blue.checked = 0
  505. purple.checked = 0
  506. bluegray.checked = 0
  507. gray.checked = 0
  508. h = &HFF&
  509. pickup.backColor = h
  510. label1.backColor = h
  511. label2.backColor = h
  512. label3.backColor = h
  513. label4.backColor = h
  514. label5.backColor = h
  515. End Sub
  516. Sub Timer1_Timer ()
  517. If Val(label1.caption) = 1 Then
  518.     label4.caption = Str$(1)
  519.     label1.caption = Str$(0)
  520.     MsgBox "You Won!", 48, "Congratulations": Exit Sub
  521. End If
  522. If i = 3 Then
  523.     For e = 1 To 21 Step 4
  524.         If x - e > 0 And x - e < 4 Then
  525.             label4.caption = Str$(x - e)
  526.             label1.caption = Str$(e): x = Val(label1.caption)
  527.         ElseIf x - e = 0 And x <> 1 Then
  528.             y = Int(3 * Rnd + 1)
  529.             label4.caption = Str$(y)
  530.             label1.caption = Str$(x - y): x = Val(label1.caption)
  531.         End If
  532.     Next e
  533. If (Val(label1.caption) > 8 And i < 3) Or (Val(label1.caption) = 5 And i < 3) Or (i = 1 And Val(label1.caption) > 5) Then
  534.     If i < 3 Then
  535.     y = Int(3 * Rnd + 1)
  536.     label4.caption = Str$(y)
  537.     x = Val(label1.caption)
  538.     label1.caption = Str$(x - y)
  539.     End If
  540. ElseIf Val(label1.caption) < 9 And Val(label1.caption) > 5 And i > 1 Then
  541.     For d = 6 To 8
  542.         If d = Val(label1.caption) Then
  543.             y = d - 5
  544.             label4.caption = Str$(y)
  545.             x = Val(label1.caption)
  546.             label1.caption = Str$(x - y)
  547.         End If
  548.     Next d
  549. ElseIf Val(label1.caption) < 5 And Val(label1.caption) > 1 Then
  550.     For a = 2 To 4
  551.         If a = Val(label1.caption) Then
  552.             y = a - 1
  553.             label4.caption = Str$(y)
  554.             x = Val(label1.caption)
  555.             label1.caption = Str$(x - y)
  556.         End If
  557.     Next a
  558. End If
  559. End If
  560. timer1.enabled = 0
  561. End Sub
  562. Sub white_Click ()
  563. green.checked = 0
  564. white.checked = -1
  565. red.checked = 0
  566. yellow.checked = 0
  567. blue.checked = 0
  568. purple.checked = 0
  569. bluegray.checked = 0
  570. gray.checked = 0
  571. h = &HFFFFFF
  572. pickup.backColor = h
  573. label1.backColor = h
  574. label2.backColor = h
  575. label3.backColor = h
  576. label4.backColor = h
  577. label5.backColor = h
  578. End Sub
  579. Sub yellow_Click ()
  580. green.checked = 0
  581. white.checked = 0
  582. red.checked = 0
  583. yellow.checked = -1
  584. blue.checked = 0
  585. purple.checked = 0
  586. bluegray.checked = 0
  587. gray.checked = 0
  588. h = &HFFFF&
  589. pickup.backColor = h
  590. label1.backColor = h
  591. label2.backColor = h
  592. label3.backColor = h
  593. label4.backColor = h
  594. label5.backColor = h
  595. End Sub
  596. Sub youstart_Click ()
  597. c = 0
  598. youstart.checked = -1
  599. compstart.checked = 0
  600. label1.caption = Str$(23)
  601. label4.caption = ""
  602. End Sub
  603.